{% extends 'base.html.twig' %}
{% import 'Import/app_import.html.twig' as appImport %}

{% block head_title %}{{ 'indices'|trans }} - {{ index.name }} - {{ 'aliases'|trans }}{% endblock %}

{% block heading_1 %}
    {{ appImport.heading({'level': 1, 'title': 'indices'|trans, 'link': {'url': path('indices')}}) }}
{% endblock %}

{% block heading_2 %}
    {{ appImport.heading({'level': 2, 'title': index.name, 'badge': {'title': index.health|trans, 'context': index.health}}) }}
{% endblock %}

{% block tabs %}
    {% include 'Modules/index/index_read_tabs.html.twig' with {'active': 'aliases'} %}
{% endblock %}

{% block main_content %}
    {% embed 'Embed/block_embed.html.twig' %}
        {% import 'Import/app_import.html.twig' as appImport %}
        {% block content %}
            {{ appImport.heading({'level': 3, 'title': 'aliases'|trans, 'badge': {'title': aliases.total}}) }}

            {% if is_granted('INDEX_ALIAS_CREATE', index) %}
                {% embed 'Embed/buttons_embed.html.twig' %}
                    {% block content %}
                        <a class="btn btn-primary btn-sm" href="{{ path('indices_aliases_create', {'index': index.name}) }}">{{ 'add'|trans }}</a>
                    {% endblock %}
                {% endembed %}
            {% endif %}

            {% if 0 < aliases.total %}
                {{ appImport.paginator(aliases) }}

                {% include 'Modules/index/index_read_aliases_list.html.twig' with {'aliases': aliases} %}

                {{ appImport.paginator(aliases) }}
            {% endif %}
        {% endblock %}
    {% endembed %}
{% endblock %}
